<?php

namespace App\Services;

use App\Models\UpcustomerBu;
use Slowlyo\OwlAdmin\Services\AdminService;

/**
 * 业务管理
 *
 * @method UpcustomerBu getModel()
 * @method UpcustomerBu|\Illuminate\Database\Query\Builder query()
 */
class UpcustomerBuService extends AdminService
{
	protected string $modelName = UpcustomerBu::class;

	public function listQuery()
	{
		$model = $this->getModel();
		return $this->query()->with('sign_company', 'upcustomer', 'idcnode')->orderByDesc($model->getUpdatedAtColumn());
	}

	public function getData($up_customer_id)
	{
		if ($up_customer_id) {
			return $this->listQuery()->where('upcustomer_id', $up_customer_id)->get();
		}else{
			return $this->listQuery()->get();
		}
	}
}